package com.scjp_Java6.ExceptionHandling;

/*
 * Create a class with two methods, f( ) and g( ).
 *  In g( ), throw an exception of a new type that you define.
 *  In f( ), call g( ), catch its exception and, in the catch clause, throw a different exception (of a second type that you define). 
 *	Test your code in main( ).
 */
public class TIJ_Ex_5 {

	void f() throws MyException2 {
		try {
			g();
		} catch (MyException e) {
			System.out.println(e.getMessage());
			try {
				throw new MyException2(
						"Thrown form MyException2 in f() constructor...");
			} catch (Exception e2) {
				System.out.println("Not treated exception! ;)");
			}
			
		}
	}

	void g() throws MyException {
		throw new MyException("Thrown myException form g()....");
	}

	public static void main(String[] args) throws MyException, MyException2 {
		new TIJ_Ex_5().f();

	}
}
